// 创建EventBus类
class EventBus {
    constructor() {
      this.events = {};
    }
   
    on(event, callback) {
      this.events[event] = this.events[event] || [];
      this.events[event].push(callback);
    }
   
    emit(event, ...args) {
      (this.events[event] || []).forEach(callback => callback(...args));
    }
   
    off(event, callback) {
      this.events[event] = (this.events[event] || []).filter(cb => cb !== callback);
    }
  }
   
  // 使用EventBus
 export default new EventBus();
   